<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="shortcut icon" href="<%=basePath %>/static/css/logo.png">
	<link rel="stylesheet" href="<%=basePath %>/static/css/iconfont.css">
	<link rel="stylesheet" href="<%=basePath %>/static/css/global.css">
	<link rel="stylesheet" href="<%=basePath %>/static/css/bootstrap.min.css">
	<link rel="stylesheet" href="<%=basePath %>/static/css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="<%=basePath %>/static/css/swiper.min.css">
	<link rel="stylesheet" href="<%=basePath %>/static/css/styles.css">
	<link rel="stylesheet" href="<%=basePath %>/static2/assets/layer/skin/layer.css">
	<script src="<%=basePath %>/static/js/jquery.1.12.4.min.js" charset="UTF-8"></script>
	<script src="<%=basePath %>/static/js/bootstrap.min.js" charset="UTF-8"></script>
	<script src="<%=basePath %>/static/js/swiper.min.js" charset="UTF-8"></script>
	<script src="<%=basePath %>/static/js/global.js" charset="UTF-8"></script>
	<script src="<%=basePath %>/static/js/jquery.DJMask.2.1.1.js" charset="UTF-8"></script>
	<script src="<%=basePath %>/static2/assets/layer/layer.js" charset="UTF-8"></script>
	<script type="text/javascript">
		//alert("script");
		$(document).ready(function(){
			//alert("jintu");
			//$("#jiazai").on("click",function(){
				//alert("click");
				var userid = '<%=session.getAttribute("userid")%>';
				//alert(userid);
				//alert("this is "+userid);
				
			//});
				//查询到所有的订单
				//$.ajax({
				//	type:"POST",
				//	url:"../web/getorders",
					//data:"userid="+userid,
					//dataType:"json",
				//	success:function(data){
						//alert("ajax");
						
				//	}
			//});
		});
		
		function member_del(obj,id){
			layer.confirm('确认要删除吗？',function(index){
				$.ajax({
					type:"GET",
					url:"../web/qxorder",
					data:{orderid:id},
					//dataType:"json",
					success:function(data){
					}
				});
				$(obj).parents("tr").remove();
				layer.msg('已删除!',{icon:1,time:1000});
			});
		}
		
		function openadd(orderId){
		    layer.open({
		        type: 2,
		        skin: 'layui-layer-demo', //样式类名
		        title: '订单内容',
		        closeBtn: 0, //不显示关闭按钮
		        anim: 2,
		        area: ['500px', '300px'],
		        shadeClose: true, //开启遮罩关闭
		        content: '../web/getordersDetail?orderId='+orderId
		    });
		}
		
		function changeStatus(obj,orderId,oldStatus,newStatus){
			layer.confirm('确认付款',function(index){
				$.ajax({
					type:"GET",
					url:"../web/reorderStatus",
					data:{orderId:orderId,oldStatus:oldStatus,newStatus:newStatus},
					//dataType:"json",
					success:function(data){
					}
				});
				$(obj).remove();
				layer.msg('已付款!',{icon:1,time:1000});
			});
		}
		
		function changeStatus2(obj,orderId,oldStatus,newStatus){
			layer.confirm('确认签收',function(index){
				$.ajax({
					type:"GET",
					url:"../web/reorderStatus",
					data:{orderId:orderId,oldStatus:oldStatus,newStatus:newStatus},
					//dataType:"json",
					success:function(data){
					}
				});
				layer.msg('已签收!',{icon:1,time:1000});
			});
		}
	</script>
	<title>卓越图书</title>
</head>
<body>
	<!-- 顶部tab -->
	<div class="tab-header">
		<div class="inner">
			<div class="pull-left">
				<div class="pull-left">嗨，欢迎来到<a class="cr" id="jiazai">zl图书,${username } </a></div>
			</div>
			
		</div>
	</div>
	<!-- 顶部标题 -->
	<div class="bgf5 clearfix">
		<div class="top-user">
			<div class="inner">
				<a class="logo" href="<%=basePath %>jsp/homePage.jsp"><img src="<%=basePath %>/static/css/logo.png" alt="zlBOOK" class="cover"></a>
				<div class="title">个人中心</div>
			</div>
		</div>
	</div>
	<div class="content clearfix bgf5">
		<section class="user-center inner clearfix">
			<div class="pull-left bgf">
				<a class="title">欢迎使用</a>
				<dl class="user-center__nav">
					<dt>帐户信息</dt>
					<a href="<%=basePath %>/jsp/udai_userInfo.jsp"><dd>个人资料</dd></a>
					<a href="<%=basePath %>/jsp/udai_address.jsp"><dd>收货地址</dd></a>
					<a href="<%=basePath %>/jsp/udai_pwd_modify.jsp"><dd>修改登录密码</dd></a>
				</dl>
				<dl class="user-center__nav">
					<dt>订单中心</dt>
					<a href="<%=basePath %>web/getorders"><dd>我的订单</dd></a>
				</dl>
			</div>
			<div class="pull-right">
				<div class="user-center__info bgf">
					<div class="pull-left clearfix">
						<div class="port b-r50 pull-left">
							<img src="<%=basePath %>/static/css/logo.png" alt="用户名" class="cover b-r50">
							<a href="<%=basePath %>/jsp/udai_setting.jsp" class="edit"><i class="iconfont icon-edit"></i></a>
						</div>
						<p class="name text-nowrap">您好，15037293823！</p>
					</div>
					<div class="pull-right user-nav">
						<a href="" class="user-nav__but">
							<i class="iconfont icon-rmb fz40 cr"></i>
							<div class="c6">待支付 <span class="cr">1</span></div>
						</a>
						<a href="" class="user-nav__but">
							<i class="iconfont icon-eval fz40 cr"></i>
							<div class="c6">待评价 <span class="c3">0</span></div>
						</a>
						<a href="" class="user-nav__but">
							<i class="iconfont icon-xiaoxi fz40 cr"></i>
							<div class="c6">消息 <span class="cr">2</span></div>
						</a>
					</div>
				</div>
				<div class="order-list__div bgf">
					<div class="user-title">
						我的订单<span class="c6"></span>
					</div>
					<div class="order-panel">
						<ul class="nav user-nav__title" role="tablist">
							<li role="presentation" class="nav-item active"><a href="#all" aria-controls="all" role="tab" data-toggle="tab">所有订单</a></li>
							<li role="presentation" class="nav-item "><a href="#pay" aria-controls="pay" role="tab" data-toggle="tab">待付款 <span class="cr"></span></a></li>
							<li role="presentation" class="nav-item "><a href="#emit" aria-controls="emit" role="tab" data-toggle="tab">待发货 <span class="cr"></span></a></li>
							<li role="presentation" class="nav-item "><a href="#take" aria-controls="take" role="tab" data-toggle="tab">待收货 <span class="cr"></span></a></li>
							<li role="presentation" class="nav-item "><a href="#eval" aria-controls="eval" role="tab" data-toggle="tab">已签收 <span class="cr"></span></a></li>
						</ul>

						<div class="tab-content">
							<div role="tabpanel" class="tab-pane fade in active" id="all">
								<table class="table text-center">
									<tr>
										<th width="380">商品信息</th>
										
										<th width="120">实付款</th>
										<th width="120">交易状态</th>
										<th width="120">交易操作</th>
									</tr>
									<c:forEach  items="${orderList}" var="order" >
										<tr class="order-item" id="">
											<td>
												<label>
													<div class="num">
														<!-- <input type="checkbox"> -->
														生成时间：<fmt:formatDate value="${order.time }" pattern="yyyy-MM-dd HH:mm:ss"/>
														<br>订单号: ${order.orderids }
													</div>
													<div class="card">
														
														<div class="name ep2"></div>
													</div>
												</label>
											</td>
											
											<td>${order.shifukuan }<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
											<td class="state">
												<a class="but c6">${order.zhuangtai }</a>
											</td>
											<td class="order">
												<button href="" onclick="openadd('${order.orderids}')" id="qxorder" class="but c3">查看订单</button>
												<span onclick="changeStatus(this,'${order.orderids}',0,1)" class="but but-primary">付款</span>
												<!-- <a href="" class="but but-link">评价</a> -->
												<button href="" onclick="member_del(this,'${order.orderids }')" id="qxorder" class="but c3">取消订单</button>
												<span onclick="changeStatus2(this,'${order.orderids}',2,3)" class="but but-primary">签收</span>
											</td>
										</tr>
									</c:forEach>
									
								</table>
							</div>
							<div role="tabpanel" class="tab-pane fade" id="pay">
								<table class="table text-center">
									<tr>
										<th width="380">商品信息</th>
										
										<th width="120">实付款</th>
										<th width="120">交易状态</th>
										<th width="120">交易操作</th>
									</tr>
									<c:forEach  items="${orderPayList}" var="order" >
										<tr class="order-item" id="">
											<td>
												<label>
													<div class="num">
														<!-- <input type="checkbox"> -->
														生成时间：<fmt:formatDate value="${order.time }" pattern="yyyy-MM-dd HH:mm:ss"/>
														<br>订单号: ${order.orderids }
													</div>
													<div class="card">
														
														<div class="name ep2"></div>
													</div>
												</label>
											</td>
											
											<td>${order.shifukuan }<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
											<td class="state">
												<a class="but c6">${order.zhuangtai }</a>
											</td>
											<td class="order">
												<button href="" onclick="openadd('${order.orderids}')" id="qxorder" class="but c3">查看订单</button>
												<span onclick="changeStatus(this,'${order.orderids}',0,1)" class="but but-primary">付款</span>
												<!-- <a href="" class="but but-link">评价</a> -->
												<button href="" onclick="member_del(this,'${order.orderids }')" id="qxorder" class="but c3">取消订单</button>
												<span onclick="changeStatus2(this,'${order.orderids}',2,3)" class="but but-primary">签收</span>
											</td>
										</tr>
									</c:forEach>
									
								</table>
							</div>
							<div role="tabpanel" class="tab-pane fade" id="emit">
								<table class="table text-center">
									<tr>
										<th width="380">商品信息</th>
										
										<th width="120">实付款</th>
										<th width="120">交易状态</th>
										<th width="120">交易操作</th>
									</tr>
									<c:forEach  items="${orderEmitList}" var="order" >
										<tr class="order-item" id="">
											<td>
												<label>
													<div class="num">
														<!-- <input type="checkbox"> -->
														生成时间：<fmt:formatDate value="${order.time }" pattern="yyyy-MM-dd HH:mm:ss"/>
														<br>订单号: ${order.orderids }
													</div>
													<div class="card">
														
														<div class="name ep2"></div>
													</div>
												</label>
											</td>
											
											<td>${order.shifukuan }<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
											<td class="state">
												<a class="but c6">${order.zhuangtai }</a>
											</td>
											<td class="order">
												<button href="" onclick="openadd('${order.orderids}')" id="qxorder" class="but c3">查看订单</button>
												<span onclick="changeStatus(this,'${order.orderids}',0,1)" class="but but-primary">付款</span>
												<!-- <a href="" class="but but-link">评价</a> -->
												<button href="" onclick="member_del(this,'${order.orderids }')" id="qxorder" class="but c3">取消订单</button>
												<span onclick="changeStatus2(this,'${order.orderids}',2,3)" class="but but-primary">签收</span>
											</td>
										</tr>
									</c:forEach>
									
								</table>
							</div>
							<div role="tabpanel" class="tab-pane fade" id="take">
								<table class="table text-center">
									<tr>
										<th width="380">商品信息</th>
										
										<th width="120">实付款</th>
										<th width="120">交易状态</th>
										<th width="120">交易操作</th>
									</tr>
									<c:forEach  items="${orderTakeList}" var="order" >
										<tr class="order-item" id="">
											<td>
												<label>
													<div class="num">
														<!-- <input type="checkbox"> -->
														生成时间：<fmt:formatDate value="${order.time }" pattern="yyyy-MM-dd HH:mm:ss"/>
														<br>订单号: ${order.orderids }
													</div>
													<div class="card">
														
														<div class="name ep2"></div>
													</div>
												</label>
											</td>
											
											<td>${order.shifukuan }<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
											<td class="state">
												<a class="but c6">${order.zhuangtai }</a>
											</td>
											<td class="order">
												<button href="" onclick="openadd('${order.orderids}')" id="qxorder" class="but c3">查看订单</button>
												<span onclick="changeStatus(this,'${order.orderids}',0,1)" class="but but-primary">付款</span>
												<!-- <a href="" class="but but-link">评价</a> -->
												<button href="" onclick="member_del(this,'${order.orderids }')" id="qxorder" class="but c3">取消订单</button>
												<span onclick="changeStatus2(this,'${order.orderids}',2,3)" class="but but-primary">签收</span>
											</td>
										</tr>
									</c:forEach>
									
								</table>
							</div>
							<div role="tabpanel" class="tab-pane fade" id="eval">
								<table class="table text-center">
									<tr>
										<th width="380">商品信息</th>
										
										<th width="120">实付款</th>
										<th width="120">交易状态</th>
										<th width="120">交易操作</th>
									</tr>
									<c:forEach  items="${orderEvalList}" var="order" >
										<tr class="order-item" id="">
											<td>
												<label>
													<div class="num">
														<!-- <input type="checkbox"> -->
														生成时间：<fmt:formatDate value="${order.time }" pattern="yyyy-MM-dd HH:mm:ss"/>
														<br>订单号: ${order.orderids }
													</div>
													<div class="card">
														
														<div class="name ep2"></div>
													</div>
												</label>
											</td>
											
											<td>${order.shifukuan }<br><span class="fz12 c6 text-nowrap">(含运费: ¥0.00)</span></td>
											<td class="state">
												<a class="but c6">${order.zhuangtai }</a>
											</td>
											<td class="order">
												<button href="" onclick="openadd('${order.orderids}')" id="qxorder" class="but c3">查看订单</button>
												<span onclick="changeStatus(this,'${order.orderids}',0,1)" class="but but-primary">付款</span>
												<!-- <a href="" class="but but-link">评价</a> -->
												<button href="" onclick="member_del(this,'${order.orderids }')" id="qxorder" class="but c3">取消订单</button>
												<span onclick="changeStatus2(this,'${order.orderids}',2,3)" class="but but-primary">签收</span>
											</td>
										</tr>
									</c:forEach>
									
								</table>
							</div>
						</div>
					</div>
				</div>
				
			</div>
		</section>
	</div>
	<!-- 右侧菜单 -->
	<div class="right-nav">
		<ul class="r-with-gotop">
			<li class="r-toolbar-item">
				<a href="udai_welcome.jsp" class="r-item-hd">
					<i class="iconfont icon-user" data-badge="0"></i>
					<div class="r-tip__box"><span class="r-tip-text">用户中心</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="udai_shopcart.jsp" class="r-item-hd">
					<i class="iconfont icon-cart"></i>
					<div class="r-tip__box"><span class="r-tip-text">购物车</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="" class="r-item-hd">
					<i class="iconfont icon-aixin"></i>
					<div class="r-tip__box"><span class="r-tip-text">我的收藏</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="" class="r-item-hd">
					<i class="iconfont icon-liaotian"></i>
					<div class="r-tip__box"><span class="r-tip-text">联系客服</span></div>
				</a>
			</li>
			<li class="r-toolbar-item">
				<a href="" class="r-item-hd">
					<i class="iconfont icon-liuyan"></i>
					<div class="r-tip__box"><span class="r-tip-text">留言反馈</span></div>
				</a>
			</li>
			<li class="r-toolbar-item to-top">
				<i class="iconfont icon-top"></i>
				<div class="r-tip__box"><span class="r-tip-text">返回顶部</span></div>
			</li>
		</ul>
		<script>
			$(document).ready(function(){ $('.to-top').toTop({position:false}) });
		</script>
	</div>
	<!-- 底部信息 -->
	<div class="footer">
		<div class="footer-tags">
			<div class="tags-box inner">
				<div class="tag-div">
					<img src="<%=basePath %>/static/images/icons/footer_1.gif" alt="厂家直供">
				</div>
				<div class="tag-div">
					<img src="<%=basePath %>/static/images/icons/footer_2.gif" alt="一件代发">
				</div>
				<div class="tag-div">
					<img src="<%=basePath %>/static/images/icons/footer_3.gif" alt="美工活动支持">
				</div>
				<div class="tag-div">
					<img src="<%=basePath %>/static/images/icons/footer_4.gif" alt="信誉认证">
				</div>
			</div>
		</div>
		<div class="copy-box clearfix">
			<!-- 版权 -->
			<p class="copyright">
				© 2019-2019 卓越图书网 版权所有，并保留所有权利<br>
			</p>
		</div>
	</div>
</body>
</html>